package image

import (
	"go-ocr/global"
	"image/png"
	"os"

	"github.com/kbinani/screenshot"
)

/**
 * 在指定点进行截图，返回图片保存路径
 */
func GenerateScreen(point Point, imagePath string) {
	//bounds := screenshot.GetDisplayBounds(0)
	//dx := bounds.Dx()
	//dy := bounds.Dy()
	img, err := screenshot.Capture(point.X, point.Y, global.Conf.Screenshot.Width, global.Conf.Screenshot.Heigth)
	if err != nil {
		panic(err)
	}
	file, _ := os.Create(imagePath)
	defer file.Close()
	png.Encode(file, img)
}
